<?php
require_once(dirname(__FILE__) . '/app.php');

$code = $_GET['code'];
$condition['code'] = $code;
$condition['type'] = 0;
//查询数据库是否有该源码
$str = TeamCode::LimitQuery('teamCode', array('condition'=>$condition));
if($str){
	$result = TeamCode::Update('user', $login_user_id, array('code'=>$code), 'id');
	$strs = TeamCode::Update('teamCode',$login_user_id,array('type'=>1),'id');
	if($result && $strs){
		echo "yes";
		exit;
	}else{
		echo "error";
		exit;
	}
}else{
	echo "Use";
	exit;
}


